import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MaterialModelHistoryInfoVO, MaterialModelHistoryInfoForm, MaterialModelHistoryInfoQuery } from '@/api/material/materialModelHistoryInfo/types';

/**
 * 查询物料型号历史列表
 * @param query
 * @returns {*}
 */

export const listMaterialModelHistoryInfo = (query?: MaterialModelHistoryInfoQuery): AxiosPromise<MaterialModelHistoryInfoVO[]> => {
  return request({
    url: '/material/materialModelHistoryInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询物料型号历史详细
 * @param id
 */
export const getMaterialModelHistoryInfo = (id: string | number): AxiosPromise<MaterialModelHistoryInfoVO> => {
  return request({
    url: '/material/materialModelHistoryInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增物料型号历史
 * @param data
 */
export const addMaterialModelHistoryInfo = (data: MaterialModelHistoryInfoForm) => {
  return request({
    url: '/material/materialModelHistoryInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改物料型号历史
 * @param data
 */
export const updateMaterialModelHistoryInfo = (data: MaterialModelHistoryInfoForm) => {
  return request({
    url: '/material/materialModelHistoryInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除物料型号历史
 * @param id
 */
export const delMaterialModelHistoryInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/material/materialModelHistoryInfo/' + id,
    method: 'delete'
  });
};
